package com.runoob.media.adapter;

import com.runoob.media.video.AdvancedMediaPlayer;
import com.runoob.media.audio.MediaPlayer;
import com.runoob.media.video.Mp4Player;
import com.runoob.media.video.VlcPlayer;

/**
 * title
 * <p>
 *
 * </p>
 *
 * @author zenglei
 * @date 2023/05/31/ 15:58
 */
public class MediaAdapter implements MediaPlayer {
    private AdvancedMediaPlayer advancedMusicPlayer;

    public MediaAdapter(String audioType) {

        if (audioType.equalsIgnoreCase("vlc")) {
            advancedMusicPlayer = new VlcPlayer();
        } else if (audioType.equalsIgnoreCase("mp4")) {
            advancedMusicPlayer = new Mp4Player();
        }

    }

    @Override
    public void play(String audioType, String fileName) {

        if (audioType.equalsIgnoreCase("vlc")) {
            advancedMusicPlayer.playVlc(fileName);
        } else if (audioType.equalsIgnoreCase("mp4")) {
            advancedMusicPlayer.playMp4(fileName);
        }

    }
}
